﻿using System;
using System.Collections.Generic;
using System.Drawing;
using System.Text;
using Sharp3DMath.Core;

namespace Sharp3DMath.Core
{
    public static class Coordinate
    {
       /// <summary>
       /// 
       /// </summary>
       /// <param name="clientRect"></param>
       /// <param name="points"></param>
       /// <param name="logicPoints">输出逻辑坐标</param>
        public static void ChangeCoordinate(Rectangle clientRect,Vector2F[] points,ref Vector2F[] logicPoints)
        {
            ChangeCoordinate(clientRect.Height, points,ref logicPoints); 
        }
        public static void ChangeCoordinate(int height, Vector2F[] points)
        {
            for (int i = 0; i < points.Length; i++)
            {
                points[i].Y = height - points[i].Y;
            }
        }
        /// <summary>
        /// 屏幕坐标系转换
        /// </summary>
        /// <param name="clientRect"></param>
        /// <param name="points"></param>
        public static void ChangeCoordinate(Rectangle clientRect,Vector2F[] points)
        {
            ChangeCoordinate(clientRect.Height, points);
        }
        public static void ChangeCoordinate(int height , Vector2F[] points,ref Vector2F[] logicPoints)
        {
            logicPoints = new Vector2F[points.Length];
            for (int i = 0; i < points.Length; i++)
            {
                logicPoints[i] = new Vector2F(points[i]);
                logicPoints[i].Y = height - logicPoints[i].Y;
            }
        }
    }
}
